import {xmlString} from './01.ts'
let parser = new DOMParser();
let xmlDoc = parser.parseFromString(xmlString, "text/xml");

// 查找所有的<trkpt>元素
let trkpts = xmlDoc.getElementsByTagName("trkpt");
const arr=[];
export function getTrkpt(){
    // 遍历<trkpt>元素
    for (let i = 0; i < trkpts.length; i++) {
        let trkpt = trkpts[i];
        let lat = trkpt.getAttribute("lat");
        let lon = trkpt.getAttribute("lon");
                                if(i==5)      console.log(lat, lon)
        arr.push([Number(lon), Number(lat)])
    }
    console.log('arr',arr);

}
